package com.hsxshop.util;

import sun.misc.BASE64Encoder;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * Created by wangchongya on 17/7/19.
 */
public class MD5Util {

    public static String getMD5Str(String origStr){
        MessageDigest md =
                null;
        try {
            md = MessageDigest.getInstance("md5");
        } catch (NoSuchAlgorithmException e) {
            return "";
        }

        byte[] buf = md.digest(origStr.getBytes());
        BASE64Encoder encoder =
                new BASE64Encoder();
        String str2 = encoder.encode(buf);
        return str2;
    }
}
